feat(scraper): add self-healing scraper heal command#11
Merged
Conversation
4 tasks
Collaborator
Author
Update: self-healing approval gate +
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
bdata scraper heal <collector_id> "<prompt>"— AI self-healing for scrapers. When a scraper drifts (selectors move, a page redesigns), the agent fixes it in place instead of rebuilding, so the savedcollector_idkeeps working and improves.scraper heal— the maintenance twin ofscraper create:POST /dca/collectors/{id}/refactor_template→ pollrefactor_template/progress, reusing the existing async trigger→poll machinery (poll_until,build_ai_trigger_retry,SCRAPER_BODY_HINTS, the 429 backoff).runstays read-only — there is no--healflag onrun.healemits a{collector_id, status, completed_steps, prompt, view_url, next_step}envelope (same shape ascreate), wherenext_stepis a ready-to-runbdata scraper run <id> <url>verify command (--urlbakes the real URL in). The intended agent flow is: run → inspect → heal → re-run → verify.create's "half-built collector" wording).<prompt>(≤1000 chars, validated fast); carries over--timeout,--max-retries/--no-retry,-o/--json/--pretty/--legacy-output/--timing/-k.Built test-first; 25 new tests. Design + plan in
docs/superpowers/.Test Plan
pnpm type-checkcleanpnpm buildcleansrc/__tests__/commands/scraper.test.ts— 131/131 pass (incl. validation, all failure paths, retry forwarding, legacy-output, progress-endpoint URL, exit codes, subcommand wiring)bdata scraper heal --helpshows args/options/examples;bdata scraper --helplistshealbdata scraper run --helphas no--healoption (design invariant)